<?php

/**
 * Sessions module
 *
 * @author coder_
 */

class Session extends _Module
{
    private static $instance;
    
    private $dependencies = array();

    private function __construct()
    {
    }

    private function __clone()
    {
    }

    public static function &getInstance()
    {
        if (is_null(self::$instance)) {
            self::$instance = new self;
        }
        return self::$instance;
    }

    public function initialize()
    {
        session_start();
    }

    public function Destroy()
    {
        session_destroy();
    }

    public function getDependencies()
    {
        return $this->dependencies;
    }

    public function __get($name)
    {
        return isset($_SESSION[$name]) ? $_SESSION[$name] : null;
    }

    public function __set($name, $value)
    {
        $_SESSION[$name] = $value;
    }
}